package com.kitty.game.rank.model.record;

import lombok.Getter;
import lombok.Setter;

/**通天塔挑战排行榜记录*/
@Setter
@Getter
public class TowerRankRecord extends RankRecord {
    private String gid;
    private int layer;//历史最高层
    private String name;//角色名称
    private short level;
    private short polar;//门派 相性

    public TowerRankRecord() {}

    public TowerRankRecord(String gid, int layer, String name, short level, short polar) {
        this.gid = gid;
        this.layer = layer;
        this.name = name;
        this.level = level;
        this.polar = polar;
    }

    @Override
    public int compareTo(RankRecord o) {
        /**按层数从大到小排序*/
        TowerRankRecord other = (TowerRankRecord)o;
        if (layer != other.getLayer()) {
            return layer > other.getLayer() ? -1 : 1;
        }

        /**层数一样时，就按gid排序吧，保证不是同一个玩家就好了*/
        return gid.compareTo(other.getGid());
    }
}
